const tableOption = {
    border: true,
    card: true,
    index: true,
    indexLabel: '序号',
    stripe: true,
    menu: true,
    menuAlign: 'center',
    filterBtn: false,
    menuWidth: 300,
    align: 'center',
    viewBtn: false,
    editBtn: false,
    delBtn: false,
    addBtn: false,
    searchMenuSpan: 6,
    dialogWidth: '85%',
    labelWidth: 130,
    dialogHeight: '78%',
    column: [

        {
            label: '供应商名称',
            prop: 'supplierName',
            search: true,
            placeholder: '供应商名称',
            rules: [{
                required: true,
                message: '供应商名称',
                trigger: 'blur'
            }],
            editDisabled: true
        },
        {
            label: '邮箱',
            prop: 'sendEmail',
            search: true,
            rules:
                [{
                    required: true,
                    message: '请输入邮箱',
                    trigger: 'blur'
                }],
            editDisabled: true
        },
        {
            label: '创建者',
            prop: 'createByName',
            hide: false,
            addDisplay: false,
            editDisplay: false
        },
        {
            label: '查询时间',
            prop: 'createTime',
            type: 'datetime',
            hide: false,
            format: 'yyyy-MM-dd HH:mm:ss',
            valueFormat: 'yyyy-MM-dd HH:mm:ss',
            width: 120,
            addDisplay: false,
            editDisplay: false
        },
        {
            label: '更新者',
            prop: 'updateById',
            hide: true,
            addDisplay: false,
            editDisplay: false
        },
        {
            label: '更新时间',
            prop: 'updateTime',
            type: 'datetime',
            hide: true,
            format: 'yyyy-MM-dd HH:mm:ss',
            valueFormat: 'yyyy-MM-dd HH:mm:ss',
            width: 160,
            addDisplay: false,
            editDisplay: false
        }
    ]
}
const vm = new Vue({
    el: '#app',
    name: 'spiderStock',
    data() {
        return {
            form: {},
            cronPopover: false,
            queryParams: {}, // 全局检索条件
            tableData: [],
            dialogFormVisible: false,
            jobId: '',
            page: {
                total: 0, // 总页数
                currentPage: 1, // 当前页数
                pageSize: 10 // 每页显示多少条,
            },
            tableLoading: false,
            tableOption: tableOption,
            dialogFormVisible: false,
            content: null
        }
    },
    watch:{

    },
    computed: {


    },
    mounted: function () {
    },
    methods: {
        getList() {
            this.tableLoading = true
            axios.get('/stockHq/list',Object.assign({
                descs: 'create_time',
                current: this.page.currentPage,
                size: this.page.pageSize
            }, this.queryParams)).then(response => {
                this.tableData = response.data.data.records
                this.page.total = response.data.data.total
                this.tableLoading = false
            })
        },
        init() {
            this.dialogFormVisible = true;

        },
        /**
         * 新增定时任务持久化处理
         */
        save(row, done, loading) {
            const that = this
            axios.post('/stockHq/query',row)
                .then((rs) => {
                    const result = response.data.code
                    if (result !== 200) {
                        debugger
                        that.$notify.error(response.data.msg)
                    }else{
                        that.$notify.success('查询成功')
                        this.getList(this.page)
                        done()
                    }

                }).catch(() => {
                    loading()
                 })
        },
        /**
         * 清除全局检索条件
         */
        handleSearchReset() {
            this.queryParams = {}
        },
        /**
         * 定时任务检索查询分页查询
         */
        handleFilter(params, done) {
            this.queryParams = params
            this.page.currentPage = 1
            this.getList(this.page)
            done()
        },
        /**
         * 执行定时任务
         */
        handleContent(row) {
           this.dialogFormVisible = true
           this.content = JSON.stringify(row)

        },
        handleAdd() {
            this.$refs.crud.rowAdd()
        },
        handleUpdate(row, index) {

        },
        /**
         * 暂停定时任务
         */
        handleShutDownJob(row) {

        },
        /**
         * 刷新回调
         */
        refreshChange() {
            this.getList(this.page)
        },
        sizeChange(pageSize){
            this.page.pageSize = pageSize
        },
        currentChange(current){
            this.page.currentPage = current
        },
        closeJobLogDialog() {
            this.dialogFormVisible = false
            // this.pageLog.total = 0;
            // this.pageLog.currentPage = 1;
            // this.pageLog.pageSize = 10;
        }
    }
});